package com.project.poetry.common.exception;

import com.project.poetry.common.constant.ConstantEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义业务异常
 * @author mengxj
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ServiceException extends RuntimeException {

    private Exception exception;

    private ConstantEnum constantEnum;

    public ServiceException(String message){
        super(message);
    }

    public ServiceException(int code, String message){
        this.constantEnum = ConstantEnum.newConstant(code, message);
    }

    public ServiceException(Exception exception){
        this.exception = exception;
    }
}
